import { createApp } from 'vue';
import App from './App.vue';
const app = createApp(App);

// 引入element-plus
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';

// 注册element-plus所有图标
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
};

// 引入qilin-element3x
import QilinElement from "qilin-element3x";
import "qilin-element3x/style.css";

// 引入v-viewer图片组件
import VueViewer from "v-viewer";
import "viewerjs/dist/viewer.css";

// 引入iconfont静态图标库
import "@/assets/iconfont/iconfont.css";
import "@/assets/iconfont/iconfont.js";

// 引入iconfont动态图标库
import {
	IconfontUrlCss,
	IconfontVersion,
	loadStyle
} from '@/assets/iconfont/config.js';
IconfontVersion.forEach((item)=>{
    loadStyle(IconfontUrlCss.replace("$key",item));
});

// 引入pinia模块
import store from "@/store/index.js";

// 引入路由模块
import router from "@/router/index.js";

// 引入统一封装路由守卫方法
import "@/permission.js";

// 统一注册全局自定义组件与全局自定义指令
import {Component,Directive} from "@/global/index.js";
Object.keys(Component).forEach((item)=>{
    app.component(item,Component[item]);
});
Object.keys(Directive).forEach((item)=>{
    app.directive(item,Directive[item]);
});

app.use(ElementPlus).use(QilinElement).use(VueViewer).use(store).use(router).mount('#app');
